﻿namespace ETestIT.UI
{
    using System;
    using System.Web;
    using Domain.Services;
    using Presentation;
    using StructureMap;

    public partial class Login : PageBase<Login>
    {
        IAuthenticationService authenticationService;

        protected void Page_Load(object sender, EventArgs e)
        {
            authenticationService = ObjectFactory.GetInstance<IAuthenticationService>();
        }

        protected void btnLogin_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text)) return;

            if(authenticationService.IsValide(tbName.Text, tbPassword.Text))
                HttpContext.Current.Response.Redirect("/Candidats.aspx");
        }
    }
}